<%@ Page language="vb" CodeFile="addVehicleStep7.aspx.vb" Inherits="addVehicleStep7_aspx_vb" %>

<%
    vehicleID = Request.QueryString("vehicleID")
    If Len(vehicleID) > 0 Then 
        vehicleID = CLng(vehicleID)
        Over()
        Response.Write("<table cellpadding='0' cellspacing='0' border='0' width='1000'>")
        Response.Write("<tr>")
        Response.Write("<td valign='top'>")
        Response.Write("<table cellpadding='2' cellspacing='2' width='450'>")
        Response.Write("<tr><td class='headline' colspan='3'>PLACE LEASE CONTRACT - STEP 7 OF 7 - <font color='#fcbc00'>COMPLETED</font><hr class='hrHeadline'></td></tr>")
        Response.Write("<tr>")
        Response.Write("<td class='formBold'>The lease contract process is now completed.<br><br>Please do NOT use the ""back"" button to make any changes.</td>")
        Response.Write("</tr>")
        'Response.Write "<tr><td><br></td></tr>"
        'Response.Write "<tr><td align='right'><input type='button' value='Print details &raquo;' onClick=""window.open('printVehicle.aspx?vehicleID=" & vehicleID & "','FLS_print')""></td></tr>"
        Response.Write("<tr><td colspan='3'><hr class='hrHeadline'></td></tr>")
        Response.Write("</table>")
        Response.Write("</td>")
        Response.Write("<td width='100'></td>")
        Response.Write("<td valign='top'>")
        Response.Write("<table cellpadding='2' cellspacing='2' width='450'>")
        Response.Write("<tr><td class='headline' colspan='2'>SUBSCRIPTION PROCESS<hr class='hrHeadline'></td></tr>")
        dbOpen()
        RecSet = Conn.Execute("Select v.regnr, v.vinNumber, v.contractNumber, v.cylinderVolume, v.leaseStartDate, c.country, c.countryCurrency, p.partnerName, d.dealer, cl.client, dr.driver, pr.product, pri.priceListDuration, pri.priceListDistance, pri.priceListCategory, pri.price, pri.adminFee, b.brand, m.model From (((((((((tblVehicle v INNER JOIN tblCountry c ON c.countryID = v.countryID) INNER JOIN tblPartner p ON p.partnerID = v.partnerID) INNER JOIN tblDealer d ON d.dealerID = v.dealerID) INNER JOIN tblClient cl ON cl.clientID = v.clientID) INNER JOIN tblDriver dr ON dr.driverID = v.driverID) INNER JOIN tblProduct pr ON pr.productID = v.productID) INNER JOIN tblPriceList pri ON pri.priceListID = v.priceListID) INNER JOIN tblBrand b ON b.brandID = v.brandID) INNER JOIN tblModel m ON m.modelID = v.modelID) Where v.vehicleID = " & vehicleID & "")
        If Not RecSet.EOF Then 
            regnr = RecSet.Fields("regnr").Value
            vinNumber = RecSet.Fields("vinNumber").Value
            contractNumber = RecSet.Fields("contractNumber").Value
            cylinderVolume = RecSet.Fields("cylinderVolume").Value
            leaseStartDate = RecSet.Fields("leaseStartDate").Value
            country = RecSet.Fields("country").Value
            countryCurrency = RecSet.Fields("countryCurrency").Value
            partnerName = RecSet.Fields("partnerName").Value
            dealer = RecSet.Fields("dealer").Value
            client = RecSet.Fields("client").Value
            driver = RecSet.Fields("driver").Value
            product = RecSet.Fields("product").Value
            priceListDuration = RecSet.Fields("priceListDuration").Value
            priceListDistance = RecSet.Fields("priceListDistance").Value
            priceListCategory = RecSet.Fields("priceListCategory").Value
            price = RecSet.Fields("price").Value
            adminFee = RecSet.Fields("adminFee").Value
            brand = RecSet.Fields("brand").Value
            model = RecSet.Fields("model").Value
        End IF
        RecSet.Close()
        RecSet = Nothing
        dbOpen()
        leaseEndDate = DateAdd("m", CDbl(priceListDuration), Convert.ToDateTime(leaseStartDate))
        If Right(leaseStartDate, 2) <> "01" Then 
            leaseEndDate = DateAdd("m", CDbl("1"), Convert.ToDateTime(leaseEndDate))
        End IF
        leaseEndDate = Left(leaseEndDate, 8) & "01"
        leaseEndDate = DateAdd("d", CDbl("-1"), Convert.ToDateTime(leaseEndDate))
        Response.Write("<tr bgcolor='#eeeeee'><td>Country:</td><td>" & country & "</td></tr>")
        Response.Write("<tr><td>Partner:</td><td>" & partnerName & "</td></tr>")
        Response.Write("<tr bgcolor='#eeeeee'><td>Car dealer:</td><td>" & dealer & "</td></tr>")
        Response.Write("<tr><td>Client:</td><td>" & client & "</td></tr>")
        Response.Write("<tr bgcolor='#eeeeee'><td>Driver:</td><td>" & driver & "</td></tr>")
        Response.Write("<tr><td>Vehicle:</td><td>" & brand & " " & model & "</td></tr>")
        Response.Write("<tr bgcolor='#eeeeee'><td>Licence number:</td><td>" & regnr & "</td></tr>")
        Response.Write("<tr><td>VIN-number:</td><td>" & vinNumber & "</td></tr>")
        Response.Write("<tr bgcolor='#eeeeee'><td>Contract number:</td><td>" & contractNumber & "</td></tr>")
        Response.Write("<tr><td>Cylinder volume:</td><td>" & cylinderVolume & " cc</td></tr>")
        Response.Write("<tr bgcolor='#eeeeee'><td>Product:</td><td>" & product & "</td></tr>")
        Response.Write("<tr><td>Lease contract start date:</td><td>" & leaseStartDate & "</td></tr>")
        Response.Write("<tr bgcolor='#eeeeee'><td>Lease contract end date:</td><td>" & leaseEndDate & "</td></tr>")
        Response.Write("<tr><td>Duration:</td><td>" & priceListDuration & " months</td></tr>")
        Response.Write("<tr bgcolor='#eeeeee'><td>Driving distance:</td><td>" & priceListDistance & " km</td></tr>")
        Response.Write("<tr><td>Price category:</td><td>" & priceListCategory & "</td></tr>")
        Response.Write("<tr bgcolor='#eeeeee'><td>Price:</td><td>" & price & " " & countryCurrency & "</td></tr>")
        Response.Write("<tr><td>Administration fee:</td><td>" & adminFee & " " & countryCurrency & "</td></tr>")
        Response.Write("<tr><td colspan='2'><hr class='hrHeadline'></td></tr>")
        Response.Write("</table>")
        Response.Write("</td>")
        Response.Write("</tr>")
        Response.Write("</table>")
        Under()
    End IF
%>
